home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2001 December / pcwk12201b.iso / Wersje pelne i specjalne / Winamp 2.77 i 3.0beta / wasabi-sdk_beta1.exe / studio / common / nsGUID.h < prev    next >
C/C++ Source or Header  |  2001-10-08  |  3KB  |  92 lines

  1. /*
  2.  
  3.   Nullsoft WASABI Source File License
  4.  
  5.   Copyright 1999-2001 Nullsoft, Inc.
  6.  
  7.     This software is provided 'as-is', without any express or implied
  8.     warranty.  In no event will the authors be held liable for any damages
  9.     arising from the use of this software.
  10.  
  11.     Permission is granted to anyone to use this software for any purpose,
  12.     including commercial applications, and to alter it and redistribute it
  13.     freely, subject to the following restrictions:
  14.  
  15.     1. The origin of this software must not be misrepresented; you must not
  16.        claim that you wrote the original software. If you use this software
  17.        in a product, an acknowledgment in the product documentation would be
  18.        appreciated but is not required.
  19.     2. Altered source versions must be plainly marked as such, and must not be
  20.        misrepresented as being the original software.
  21.     3. This notice may not be removed or altered from any source distribution.
  22.  
  23.  
  24.   Brennan Underwood
  25.   brennan@nullsoft.com
  26.  
  27. */
  28.  
  29. #ifndef        _NSGUID_H
  30. #define        _NSGUID_H
  31.  
  32.  
  33. #    ifndef GUID_DEFINED // GUID Snippet
  34. #    define GUID_DEFINED
  35. //
  36. //    This is the GUID, according to Microsoft.  
  37. //
  38. //    If you have a different compiler, either implement this
  39. //    in an upstream header file, or make sure your compiler's
  40. //    GUID primitive is the same as this one.
  41. //
  42. //    YOU HAVE BEEN WARNED.
  43. //
  44.  
  45.                             typedef struct _GUID
  46.                             {
  47.                                     unsigned long Data1;
  48.                                     unsigned short Data2;
  49.                                     unsigned short Data3;
  50.                                     unsigned char Data4[8];
  51.                             } GUID;
  52.  
  53.                             #ifndef _REFCLSID_DEFINED
  54.                             #define REFGUID const GUID &
  55.                             #define _REFCLSID_DEFINED
  56.                             #endif
  57.  
  58. // This is the minimum amount of poo poo that you have to
  59. // implement to duplicate microsof's GUID primitive.
  60.  
  61. #    endif // GUID Snippet
  62.  
  63. #include "common.h"
  64.  
  65. //
  66. //
  67. //    So, hmmm.  Now, I guess, we implement some conversion functions to allow
  68. //    us to have GUIDs translatable to and from other data types.
  69. //
  70. //    Class static methods make good namespaces.
  71. class COMEXP nsGUID
  72. {
  73.     public:
  74.         // To the "Human Readable" character format.
  75.         // {1B3CA60C-DA98-4826-B4A9-D79748A5FD73}
  76.         static char *    toChar( const GUID &guid, char *target );
  77.         static GUID        fromChar( const char *source );
  78.         // To the "C Structure" character format.
  79.         //    { 0x1b3ca60c, 0xda98, 0x4826, { 0xb4, 0xa9, 0xd7, 0x97, 0x48, 0xa5, 0xfd, 0x73 } };
  80.         static char *    toCode( const GUID &guid, char *target );
  81.         static GUID        fromCode( const char *source );
  82.  
  83.   // strlen("{xx xxx xxx-xxxx-xxxx-xxxx-xxx xxx xxx xxx}"
  84.   enum { GUID_STRLEN = 38 };
  85. };
  86.  
  87.  
  88.  
  89.  
  90.  
  91. #endif    //_NSGUID_H
  92.